package com.flyxiaozhu.erp.service.authorize;

import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;

import java.io.Serializable;

/**
 * @author flyxiaozhu
 * @date 2019-04-11 0:02
 */
@Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)
@Component
@Data
public class UserSession implements Serializable {
    private static final long serialVersionUID = 2923100582476839102L;

    private long appId;

    private String nickName;

    private String phone;

    public boolean isLogin() {
        if (appId == 0 || StringUtils.isBlank(nickName) || StringUtils.isBlank(phone)) {
            return false;
        }
        return true;
    }
}
